package com.ciaojian.client.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ciaojian.core.model.Charge;
import com.ciaojian.core.service.ChargeService;
import org.springframework.stereotype.Service;

/**
 * @author oxiny
 */
@Service
public class ChargeServiceImpl extends ChargeService {

    /**
     * 分页查询
     *
     * @param userType 用户可见类型
     * @param status   状态
     * @param page     分页插件
     * @return 分页数据
     */
    public IPage<Charge> page(Integer userType, Integer status, Page<Charge> page) {
        return this.lambdaQuery()
                .in(Charge::getUserType, 0, userType)
                .eq(Charge::getStatus, status)
                .orderByAsc(Charge::getOrderBy)
                .page(page);
    }
}
